<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;
use Hyperf\DbConnection\Model\Model;
/**
 * @property int $id 
 * @property int $admin_id 
 * @property int $material_id 
 * @property int $material_assign_id 
 * @property int $material_project_id 
 * @property string $path 
 * @property string $file_type 
 * @property string $file_size 
 * @property string $file_name 
 * @property string $storage_type 
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property string $deleted_at 
 */
class MaterialReport extends Model
{
    use SoftDeletes;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'material_report';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'admin_id',
        'material_id',
        'material_assign_id',
        'material_project_id',
        'material_sheet_id',
        'path',
        'file_type',
        'file_name',
        'file_size'
    ];

    protected $appends=[
        'url'
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'int', 'admin_id' => 'integer', 'material_id' => 'integer', 'material_assign_id' => 'integer', 'material_project_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function getUrlAttribute(){
        return env('QINBIU_DOMAIN').$this->path;
    }

}